/*
 * Copyright (C) 2014 Bob Browning
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.muy.mpc.intellij.codeinsight.postfix;

import com.intellij.codeInsight.template.postfix.templates.JavaPostfixTemplateProvider;
import com.intellij.codeInsight.template.postfix.templates.PostfixTemplate;
import com.intellij.util.containers.ContainerUtil;
import java.util.HashSet;
import java.util.Set;

import com.muy.mpc.intellij.codeinsight.postfix.templates.apachecommon.ApCollections4IfEmptyPostfixTemplate;
import com.muy.mpc.intellij.codeinsight.postfix.templates.guava.surround.*;
import org.jetbrains.annotations.NotNull;
import com.muy.mpc.intellij.codeinsight.postfix.templates.guava.GuCheckArgumentPostfixTemplate;
import com.muy.mpc.intellij.codeinsight.postfix.templates.guava.GuCheckElementIndexPostfixTemplate;
import com.muy.mpc.intellij.codeinsight.postfix.templates.guava.GuCheckPositionIndexPostfixTemplate;
import com.muy.mpc.intellij.codeinsight.postfix.templates.guava.GuCheckPositionIndexesPostfixTemplate;
import com.muy.mpc.intellij.codeinsight.postfix.templates.guava.GuCheckStatePostfixTemplate;
import com.muy.mpc.intellij.codeinsight.postfix.templates.java.surround.RequireNonNullPostfixTemplate;

/**
 * Postfix template provider for extension point.
 *
 * @author Bob Browning
 */
public class GuavaPostfixTemplateProvider extends JavaPostfixTemplateProvider {

  private final HashSet<PostfixTemplate> templates;

  public GuavaPostfixTemplateProvider() {
    templates =
        ContainerUtil.newHashSet(
            new GuCheckArgumentPostfixTemplate(),
            new GuCheckElementIndexPostfixTemplate(),
            new GuCheckNotNullPostfixTemplate(),
            new GuCheckNotNullPostfixTemplate("cnn"),
            new GuCheckPositionIndexPostfixTemplate(),
            new GuCheckPositionIndexesPostfixTemplate(),
            new GuCheckStatePostfixTemplate(),
            new GuFluentIterablePostfixTemplate(),
            new GuImmutableListCopyOfPostfixTemplate(),
            new GuImmutableListOfPostfixTemplate(),
            new GuImmutableSetCopyOfPostfixTemplate(),
            new GuImmutableSetOfPostfixTemplate(),
            new GuJoinerPostfixTemplate(),
            new GuNewArrayListPostfixTemplate(),
            new GuMapsNewHashMapPostfixTemplate(),
            new GuMapsNewLinkedHashMapPostfixTemplate(),
            new ApCollections4IfEmptyPostfixTemplate(),
            new GuSplitterPostfixTemplate(),
            new GuOptionalPostfixTemplate(),
            // java 7+
            new RequireNonNullPostfixTemplate(),
            new RequireNonNullPostfixTemplate("rnn"));
  }

  @NotNull
  @Override
  public Set<PostfixTemplate> getTemplates() {
    return templates;
  }
}
